package com.rhythm.commons.validation;

import static com.rhythm.commons.validation.MessageType.*;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
/**
 *
 * @author Michael J. Lee
 */
public class MockCompanyValidator2 implements Validator<MockCompany> {

    public void checkState(MockCompany obj) throws InvalidStateException {
                ExceptionBuilder exceptionBuilder = new ExceptionBuilder();

        if (obj == null) {
            exceptionBuilder.assertNotNull(SEVERE, obj, "expected [" + MockCompany.class.getName() + "] but was [null]");
            return;
        }

        exceptionBuilder.assertNotNull(SEVERE, obj, "Name cannot be null");
        exceptionBuilder.assertFalse(SEVERE, obj.getName().length() > 20, "Name must not be greater than 20 chars");


        exceptionBuilder.trySuppress();

    }
}
